package com.enba.mallapi.module.auth.controller.resp;

import com.enba.boot.core.utils.TreeNode;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "组织结构树节点响应类-树形表格")
@Data
public class OrgTreeTableNodeResp extends TreeNode {

  public OrgTreeTableNodeResp(Long id, Long parentId, String name) {
    super(id, parentId, name);
    this.title = name;
  }

  private String title;

  @ApiModelProperty("组织机构编码")
  private String orgCode;

  @ApiModelProperty("组织机构名称")
  private String orgName;

  @ApiModelProperty("组织机构路径")
  private String orgPath;

  @ApiModelProperty("上一级组织id")
  private Long parentId;

  @ApiModelProperty("上一级组织编码")
  private String parentCode;

  @ApiModelProperty("组织机构类型（1：集团 2：公司 3：部门）")
  private Integer orgType;

  @ApiModelProperty("状态（0：启用 1：禁用）")
  private Integer status;

  @ApiModelProperty("创建时间")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime createTime;

  @ApiModelProperty("是否父节点")
  private Boolean isParent;

  public Boolean getIsParent() {
    return getChildren().size() > 0;
  }
}
